//
// Created by denglibin on 2020/6/30.
// 广度优先遍历图结构

#include "../header/graph.h"
#include <stdio.h>

static void bfs(GraphNode **nodes, int len)
{
    int flag = 1;
    for (int i = 0; i < len; i++)
    {
        if (!nodes[i]->is_visit)
        {
            flag = 0;
            printf("%c ", nodes[i]->value);
            nodes[i]->is_visit = 1;
        }
    }
    if (flag)
    {
        return;
    }
    for (int i = 0; i < len; i++)
    {
        bfs(nodes[i]->neighbor, nodes[i]->neighbor_num);
    }
}

static int main2()
{
    GraphNode *graphNode = createSimple();
    bfs(&graphNode, 1);
    return 0;
}
